
public class e017 {
    public static void main(String[] args) {
        long sTime = System.currentTimeMillis();
        StringBuilder c = new StringBuilder();
        for (int i = 1; i <= 1000; i++) {
            StringBuilder b = new StringBuilder();
            String l = "";
            if (i < 10) {
                l = "000" + String.valueOf(i);
            } else if (i < 100) {
                l = "00" + String.valueOf(i);
            } else if (i < 1000) {
                l = "0" + String.valueOf(i);
            } else {
                l = String.valueOf(i);
            }
            String[] onesNhunds = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
            String[] tens = {"", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"};
            String[] teens = {"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"};
            char oneDig = l.charAt(l.length() - 1);
            char tenDig = l.charAt(l.length() - 2);
            char hunDig = l.charAt(l.length() - 3);
            char thoDig = l.charAt(l.length() - 4);
            if (thoDig == '1') {
                b.append("one thousand ");
            }
            if (hunDig != '0') {
                b.append(onesNhunds[Integer.parseInt(String.valueOf(hunDig))]).append(" hundred");
            }
            if (tenDig != '0') {
                if (hunDig != '0') {
                    b.append(" and ");
                }
                if(tenDig != '1') {
                    b.append(tens[Integer.parseInt(String.valueOf(tenDig))]);
                } else if (tenDig == '1') {
                    b.append(teens[Integer.parseInt(String.valueOf(oneDig))]);
                }
            }
            if (oneDig != '0' && tenDig != '1') {
                if (tenDig == '0' && hunDig != '0') {
                    b.append(" and ").append(onesNhunds[Integer.parseInt((String.valueOf(oneDig)))]);
                } else if (tenDig != '0')
                {
                    b.append("-").append(onesNhunds[Integer.parseInt((String.valueOf(oneDig)))]);
                } else {
                    b.append(onesNhunds[Integer.parseInt((String.valueOf(oneDig)))]);
                }
            }
            c.append(b);
        }
        String e = c.toString();
        e = e.replace(" ", "");
        e = e.replace("-", "");
        System.out.println(e.length());
        long fTime = System.currentTimeMillis();
        System.out.println("Time: " + (fTime - sTime) + "ms");
    }
}